package edu.biwu.dao.impl;

import edu.biwu.dao.AccountDao;
import edu.biwu.po.Account;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * @author 王俊彪
 * @version 1.0
 */
@Repository
public class AccountDaoImpl implements AccountDao {
    @Resource
    JdbcTemplate jdbcTemplate;

    /**
     * 从账户加钱或减钱
     * @param account
     */
    @Override
    public void updateAccount(Account account) {
        jdbcTemplate.update("UPDATE spring.account SET money = money+? WHERE name = ?"
                ,account.getMoney(),account.getName());
    }
}
